It didn't quite turn out as I wanted it.
I'll put it in bug 619148 for now.
- Popups can be wider than the combo box itself
- The deprecated GtkComboBoxEntry subclass has been removed
- The deprecated combo box text convenience API has been removed
- - Numeric IDs can be associated with model values
* GtkRecentManager changes:
- Store xbel file in XDG_USER_DATA
gtk_combo_box_get_has_entry
gtk_combo_box_set_entry_text_column
gtk_combo_box_get_entry_text_column
-gtk_combo_box_set_id_column
-gtk_combo_box_get_id_column
<SUBSECTION Standard>
GTK_TYPE_COMBO_BOX
GTK_COMBO_BOX
gtk_combo_box_text_new
gtk_combo_box_text_new_with_entry
gtk_combo_box_text_append_text
-gtk_combo_box_text_prepend_text
gtk_combo_box_text_insert_text
-gtk_combo_box_text_insert_text_with_id
+gtk_combo_box_text_prepend_text
gtk_combo_box_text_remove
gtk_combo_box_text_remove_all
gtk_combo_box_text_get_active_text
gtk_combo_box_get_entry_text_column
gtk_combo_box_get_focus_on_click
gtk_combo_box_get_has_entry
-gtk_combo_box_get_id_column
gtk_combo_box_get_model
gtk_combo_box_get_popup_accessible
gtk_combo_box_get_popup_fixed_width
gtk_combo_box_set_column_span_column
gtk_combo_box_set_entry_text_column
gtk_combo_box_set_focus_on_click
-gtk_combo_box_set_id_column
gtk_combo_box_set_model
gtk_combo_box_set_popup_fixed_width
gtk_combo_box_set_row_separator_func
gtk_combo_box_text_get_active_text
gtk_combo_box_text_get_type G_GNUC_CONST
gtk_combo_box_text_insert_text
-gtk_combo_box_text_insert_text_with_id
gtk_combo_box_text_new
gtk_combo_box_text_new_with_entry
gtk_combo_box_text_prepend_text
gint text_column;
GtkCellRenderer *text_renderer;
- gint id_column;
-
GSList *cells;
guint popup_in_progress : 1;
PROP_EDITING_CANCELED,
PROP_HAS_ENTRY,
PROP_ENTRY_TEXT_COLUMN,
- PROP_POPUP_FIXED_WIDTH,
- PROP_ID_COLUMN
+ PROP_POPUP_FIXED_WIDTH
};
static guint combo_box_signals[LAST_SIGNAL] = {0,};
-1, G_MAXINT, -1,
GTK_PARAM_READWRITE));
- /**
- * GtkComboBox:id-column:
- *
- * The column in the combo box's model that provides numeric
- * IDs for the values in the model, if != -1.
- *
- * Since: 3.0
- */
- g_object_class_install_property (object_class,
- PROP_ID_COLUMN,
- g_param_spec_int ("id-column",
- P_("ID Column"),
- P_("The column in the combo box's model that provides "
- "numeric IDs for the values in the model"),
- -1, G_MAXINT, -1,
- GTK_PARAM_READWRITE));
-
/**
* GtkComboBox:popup-fixed-width:
*
priv->text_column = -1;
priv->text_renderer = NULL;
- priv->id_column = -1;
gtk_combo_box_check_appearance (combo_box);
}
gtk_combo_box_set_entry_text_column (combo_box, g_value_get_int (value));
break;
- case PROP_ID_COLUMN:
- gtk_combo_box_set_id_column (combo_box, g_value_get_int (value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_value_set_int (value, priv->text_column);
break;
- case PROP_ID_COLUMN:
- g_value_set_int (value, priv->id_column);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
xpad = 2 * (border_width + cell_style->xthickness);
ypad = 2 * (border_width + cell_style->ythickness);
- }
+ }
size -= but_width;
size -= 2 * focus_width;
if (natural_size)
*natural_size = nat_height;
}
-
-/**
- * gtk_combo_box_set_id_column:
- * @combo_box: A #GtkComboBox
- * @id_column: A column in @model to get numeric IDs for values from
- *
- * Sets the model column which @combo_box should use to get numeric IDs
- * for values from. The column @id_column in the model of @combo_box
- * must be of type %G_TYPE_INT.
- *
- * Since: 3.0
- */
-void
-gtk_combo_box_set_id_column (GtkComboBox *combo_box,
- gint id_column)
-{
- GtkComboBoxPrivate *priv = combo_box->priv;
- GtkTreeModel *model;
-
- g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
-
- model = gtk_combo_box_get_model (combo_box);
-
- g_return_if_fail (id_column >= 0);
- g_return_if_fail (model == NULL || id_column < gtk_tree_model_get_n_columns (model));
-
- priv->id_column = id_column;
-}
-
-/**
- * gtk_combo_box_get_id_column:
- * @combo_box: A #GtkComboBox
- *
- * Returns the column which @combo_box is using to get numeric IDs
- * for values from.
- *
- * Return value: A column in the data source model of @combo_box.
- *
- * Since: 3.0
- */
-gint
-gtk_combo_box_get_id_column (GtkComboBox *combo_box)
-{
- g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0);
-
- return combo_box->priv->id_column;
-}
void gtk_combo_box_popdown (GtkComboBox *combo_box);
AtkObject* gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
-gint gtk_combo_box_get_id_column (GtkComboBox *combo_box);
-void gtk_combo_box_set_id_column (GtkComboBox *combo_box,
- gint id_column);
G_END_DECLS
{
GtkListStore *store;
- store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
+ store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
g_object_unref (store);
}
{
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
"entry-text-column", 0,
- "id-column", 1,
NULL);
}
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
"has-entry", TRUE,
"entry-text-column", 0,
- "id-column", 1,
NULL);
}
gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
gint position,
const gchar *text)
-{
- gtk_combo_box_text_insert_text_with_id (combo_box, position, text, 0);
-}
-
-/**
- * gtk_combo_box_text_insert_text_with_id:
- * @combo_box: A #GtkComboBoxText
- * @position: An index to insert @text
- * @text: A string
- * @id: a numeric ID for this value
- *
- * Inserts @text at @position in the list of strings stored in @combo_box,
- * and sets its numeric ID to @id. See #GtkComboBox::id-column.
- *
- * Since: 3.0
- */
-void
-gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box,
- gint position,
- const gchar *text,
- gint id)
{
GtkListStore *store;
GtkTreeIter iter;
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column);
g_return_if_fail (column_type == G_TYPE_STRING);
- id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box));
- if (id_column != -1)
- {
- column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column);
- g_return_if_fail (column_type == G_TYPE_INT);
- }
gtk_list_store_insert (store, &iter, position);
- gtk_list_store_set (store, &iter, text_column, text, id_column, id, -1);
+ gtk_list_store_set (store, &iter, text_column, text, -1);
}
-
/**
* gtk_combo_box_text_remove:
* @combo_box: A #GtkComboBox
void gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box);
gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box);
-void gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box,
- gint position,
- const gchar *text,
- gint id);
G_END_DECLS